package com.ruoyi.web.controller;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.AboutUsSection;
import com.ruoyi.system.service.IAboutUsSectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author linxz
 * @since 2025-01-07
 */
@RestController
@RequestMapping("/aboutUsSection")
public class AboutUsSectionController extends BaseController {
    @Autowired
    private IAboutUsSectionService service;

    @GetMapping("/list")
    public AjaxResult list(){
        return AjaxResult.success(service.getList());

    }

    @PostMapping("/add")
    public AjaxResult add(@RequestBody AboutUsSection aboutUsSection){
        if(service.add(aboutUsSection)>0){
            return AjaxResult.success();
        }else {
            return AjaxResult.error("模块名称不能重复");
        }

    }
    @PostMapping("/update")
    public AjaxResult update(@RequestBody AboutUsSection aboutUsSection){
        return toAjax(service.update(aboutUsSection));
    }

    @PostMapping("/delete")
    public AjaxResult delete(@RequestBody AboutUsSection aboutUsSection){
        return toAjax(service.delete(aboutUsSection.getId()));
    }


}
